source_file_path = r'D:\Desktop\exceltest\1.xlsx'


from openpyxl import load_workbook

source_wb = load_workbook(source_file_path)
source_ws = source_wb['Sheet1']


source_dict = {}
source_set = set()
num = 2
cell = source_ws[f'B{num}']


while cell.value is not None:
    cell_c = source_ws[f'C{num}']
    source_set.add(f'{cell.value}-{cell_c.value}')
    num += 1
    cell = source_ws[f'B{num}']





for type_id in source_set:
    source_dict[type_id.split('-')[0]] = {}
    source_dict[type_id.split('-')[0]]['name']=type_id.split('-')[1]

num = 2
cell = source_ws[f'B{num}']
while cell.value is not None:
    field_name = source_ws[f'E{num}'].value
    field_desc = source_ws[f'F{num}'].value
    source_dict[cell.value][field_name] = field_desc
    num += 1
    cell = source_ws[f'B{num}']

xuhao = 1
for key in source_dict:
    type_dict = source_dict[key]
    content = ''
    for type_dict_key in type_dict:
        if type_dict_key != 'name':
            content = content + f'{type_dict[type_dict_key]}【{type_dict_key}】、'
    result =f'{xuhao}．{type_dict["name"]}【{key}】：{content}'[:-1]
    print(result)
    xuhao += 1

